package br.cefetpe.tsi.game.utils;

import java.util.List;
import java.util.Vector;

/**
 * Utilities class
 * @author Aluno
 *
 */
public class Utils {

	/**
	 * This class is used to verify a collection of boolean conditions
	 * @author Aluno
	 *
	 */
	public static class Assert {
		
		/**
		 * List of conditions to verify
		 */
		public List<Boolean> conditions;
		
		/**
		 * Constructor. Initializes the list of conditions as a Vector		 * 
		 *
		 */
		public Assert() {
			this.conditions = new Vector<Boolean>();
		}
		
		/**
		 * Checks all the conditions.
		 * @return True if ALL conditions are true. 
		 * False if AT LEAST ONE condition is false
		 */
		public boolean checkConditions() {
			boolean result = true;
			for (Boolean b: conditions) {
				if (b.booleanValue() == false) {
					result = false;
				}
			}			
			return result;
		}
		
		/**
		 * Adds a condition to the list of conditions
		 * @param b Condition to add
		 */
		public void addCondition(boolean b) {
			this.conditions.add(Boolean.valueOf(b));
		}
		
		/**
		 * Sets the list of conditions
		 * @param list List of conditions
		 */
		public void setConditions(List<Boolean> list) {
			this.conditions = list;			
		}
	}
}
